<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <h1>基本语义以及语法</h1>

    <h2>基础数据类型</h2>
    <script>
        //弱类型语言 ： 数据类型是自动推断出来的
        // js number string boolean 对空（Null） 未定义（Undefined）Symbol
        let a  = 2.34;
        //控制台输出
        //typeof 输出类型
        console.log(a,typeof(a));
        a = "abc";
        console.log(a,typeof(a));
        a = null;
        console.log(a,typeof(a));

        //格式是什么 
        // [let|var|const] [标识符] [=] [值];
        
        //全局变量   var 

        //局部变量    let

        //常 量      const

        const a1 = 34;

        let num1 = 23;

        let name = '23abc';

        let name1 = '23';

        let age = "3.45";

        //parseInt 转换成为整数  parseFloat

        console.log(parseInt(age),num1,name,typeof(parseInt(name1)),typeof(parseInt(name)),parseInt(name));
        

        let ist = 1;
      
        console.log(ist !== true);


        //引用类型
        // let arr = new Array(2);
        // for(let i = 0 ;i < 100000;i++){
        //     arr[arr.length] = 1;
        // }
        
        let arr = new Array();
        arr[15] = 34;

        arr[0] = 5;

        console.log(arr,arr.length);


        //初始值
        let arr1 = new Array(1,2,'3',4,5);
        // delete arr1[0];  设空
        arr1.splice(3,2,"a")
        console.log(typeof(arr1),arr1);
        

        // 是不是栈
        arr1.push(9);
        console.log(arr1);

        console.log(arr1.pop());


        //模拟一下 队列
        let q1 = new Array();
        q1[q1.length] = 1;
        q1[q1.length] = 2;
        q1[q1.length] = 3;
        q1[q1.length] = 4;

        let val = q1.shift();
        console.log(val);

        let va2 = q1.shift();
        console.log(va2);

        let arr2 = [];
        arr2.push(23);
        console.log(arr2);

        let arr3 = [1,2,3];
        console.log(arr3);
    </script>
    
</body>
</html>